<?php
session_start();
$host = "localhost";
$user = "root";
$pass = "";
$db ="eeg";
$koneksi = mysql_connect($host, $user, $pass);
if (!$koneksi) {
echo "Koneksi ke server tidak berhasil";
};
$database = mysql_select_db($db);
if (!$database) {
echo "Koneksi ke database tidak berhasil";
}
mysql_select_db($db) or die ("Database not Found !");
?>
<HTML>
<CENTER><div id="container">
	<div id="content">
		<div class="col2">
		<head> 
<meta charset="utf-8"> 
<title>Database Aritmatika</title> 
<meta name="description" content="Database Aritmatika">
<link href="bootstrap/css/bootstrap.css" rel="stylesheet"> 
</head>
<body>
<h5>Halaman</h5>
<?php 
$carisesi= $_SESSION['carisesihasilmct'];
$sql = "SELECT COUNT(Sesi) FROM mct1d1 where Sesi='$carisesi'"; 
$rs_result = mysql_query($sql); 
$row = mysql_fetch_row($rs_result); 
$total_records = $row[0]; 

$total_pages = ceil($total_records / 50); 
  
for ($i=1; $i<=$total_pages; $i++) { 
            echo "<font size ='5pt' colour = 'black'><a  href='hasilmct.php?page=".$i."'>".$i."</a> "; 
}; 


?>

<br><br>
<a href="carisesihasilmct.php"><button class="btn btn-small"  ><i class="icon-arrow-left" ></i> Kembali</button></a>
<a href="excelmct.php"><button class="btn btn-small"  ><i class="icon-arrow-left" ></i> Export</button></a>
<center><h1>
<?php
echo $carisesi;

?></h1></center>
<table class="table table-striped">
	<thead>
          <tr>
            <th>No</th>
            <th>Theta</th>
            <th>Alpha</th>
            <th>Betha</th>
			<th>Low Alpha</th>
			<th>High Alpha</th>
			<th>Low Betha</th>
			<th>High Betha</th>
			<th>Sesi</th>
			
			
          </tr>
        </thead>
<?php


if (isset($_GET["page"])) { $page  = $_GET["page"]; } else { $page=1; }; 
$start_from = ($page-1) * 50; 
$sql = "SELECT * FROM mct1d1 where Sesi='$carisesi' LIMIT $start_from, 50"; 
$rs_result = mysql_query ($sql); 

$query = "SELECT * FROM mct1d1 where Sesi='$carisesi'";
$query = mysql_query( $sql );
if(!$query){
    die( mysql_error() );
}

while( $rows = mysql_fetch_row($query) ){
    ?>
    

		<tbody>
          <tr>
            <td><?php
    echo $rows[1];
    ?></td>
            <td><?php
    echo $rows[2];
    ?> </td>
            <td><?php
    echo $rows[3];
    ?></td>
	<td><?php
    echo $rows[4];
    ?></td>
	</td>
	<td><?php
    echo $rows[5];
    ?></td>
	<td><?php
    echo $rows[6];
    ?></td>
	<td><?php
    echo $rows[7];
    ?></td>
	<td><?php
    echo $rows[8];
	
    ?>	</td>
	<td><?php
    echo $rows[9];
	
    ?>	</td>
	
	</tr>
            
         
		  
		  
	
  
  
	
<?php
}
?>
 
	 </tbody>
      </table>
</body>
</html>

</div></CENTER>
</div>
</HTML>
<!DOCTYPE html> 
<html lang="en"> 

</body>
</html>